package com.cn.wanxi.thread;

public class MyRunnableTest {
    public static void main(String[] args) {
        User user = new User();
        user.setAge(20);
        MyRunnable myRunnable = new MyRunnable(user);
        Thread thread = new Thread(myRunnable);
//        thread.setName("1");
        thread.setPriority(1);//优先级  大概率改变执行顺序
        thread.run();
        System.out.println(user.getAge());
        Thread thread1 = new Thread(myRunnable);
//        thread1.setName("2");
        thread1.start();
        Thread thread2 = new Thread(myRunnable);
//        thread2.setName("3");
        thread2.setPriority(10);
        thread2.start();
    }
}
